package com.itheima.flowcontrol.loop;

/**
 * 需求 银行投资100000 银行复利1.7% 问多少年能够翻倍？
 */
public class WhileDemo01 {
    public static void main(String[] args) {
        doubleMoney();

    }
    public static void doubleMoney() {
        int money = 100000;
        int target = money * 2;
        int year = 0;
        double rate = 0.017;
        while (money < target) {
            money += money * rate;
            year++;
        }
        System.out.println(year);
        System.out.println(money);

    }
}
